﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="registraVenda.aspx.cs" Inherits="ControleCaixa.registraVenda" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <style>
        .divPainel
        {
            margin: 20px;
            border-radius: 5px;
            background-color: #CCCCCC;
            box-shadow: 5px 5px 15px #CCE;
            padding: 20px;
            text-align: center;
            width: 92%;
            height: calc(100% - 170px);
            position: fixed;
        }
        
        .text
        {
            border-radius: 3px;
            width: 300px;
        }
        
        .Button
        {
            background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
            background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
            filter: progid:dximagetransform.microsoft.gradient(startColorstr='#646464', endColorstr='#4a4a4a', GradientType=0);
            filter: none;
            border-radius: 5px;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
            border-left: 1px solid #5d5d5d;
            box-shadow: inset 0 0 0 1px #8a8a8a;
            -moz-box-shadow: inset 0 0 0 1px #8a8a8a;
            -webkit-box-shadow: inset 0 0 0 1px #8a8a8a;
            background: #4a4a4a url(/Imagens/grad_dark.png) repeat-x left top;
            background: -moz-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #8a8a8a), color-stop(50%, #707070), color-stop(51%, #626262), color-stop(100%, #787878));
            background: -webkit-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
            background: -o-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
            background: -ms-linear-gradient(top, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
            background: linear-gradient(to bottom, #8a8a8a 0%, #707070 50%, #626262 51%, #787878 100%);
            filter: progid:dximagetransform.microsoft.gradient(startColorstr='#8a8a8a', endColorstr='#787878', GradientType=0);
            border-bottom: 1px solid #5d5d5d;
            border-top: 1px solid #5d5d5d;
            border-right: 1px solid #5d5d5d;
            line-height: 29px;
            padding: 0 30px;
            filter: none;
        }
        
        .grid
        {
            width: 70%;
            height: calc(100% - 300px);
            border-radius: 10px;
            position: relative;
            border-radius: 10px;
            margin-left: 15%;
            background: -moz-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #646464), color-stop(100%, #4a4a4a));
            background: -webkit-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -o-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: -ms-linear-gradient(top, #646464 0%, #4a4a4a 100%);
            background: linear-gradient(to bottom, #646464 0%, #4a4a4a 100%);
            overflow:auto;
        }
        
        .erro
        {
            color: red;
        }
        
        .liesquerda
        {
            width: 50%;
            text-align: right;
        }
        
        .lidiretira
        {
            width: 50%;
            text-align: left;
        }
        
        
        .liesquerdaButton
        {
            width: 50%;
            text-align: right;
        }
        
        .lidiretiraButton
        {
            width: 50%;
            text-align: left;
        }
        
        .liesquerdaButton span
        {
            display: none;
        }
        
        .lidiretiraButton span
        {
            display: none;
        }
    </style>
    <asp:ScriptManager ID="sc" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="updpainel" runat="server">
        <ContentTemplate>
            <div id="divPainel" class="divPainel" runat="server" >
                <h3>
                    Registra Venda</h3>
                <table style="width: 90%;">
                    <tr>
                        <td class="liesquerda">
                            <asp:Label ID="lblAtivo" runat="server">Cliente:</asp:Label>
                        </td>
                        <td class="lidiretira">
                            <asp:DropDownList ID="ddlCliente" runat="server" DataTextField="Nome" DataValueField="pessoaId"
                                CssClass="text">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="liesquerda">
                            <asp:Label ID="Label1" runat="server">Operação:</asp:Label>
                        </td>
                        <td class="lidiretira">
                            <asp:DropDownList ID="ddlOperacao" runat="server" DataTextField="Descricao" DataValueField="eventoId"
                                CssClass="text">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="liesquerdaButton">
                            <asp:Button ID="btnVoltar" CssClass="Button" runat="server" Text="Voltar" OnClick="btnVoltar_Click"
                                CausesValidation="false" />
                        </td>
                        <td class="lidiretiraButton">
                            <asp:Button ID="btnPesquisa" CssClass="Button" runat="server" Text="Inicia Venda"
                                OnClick="btnInicia_Click" CausesValidation="true" ValidationGroup="salvar" />
                        </td>
                    </tr>
                </table>
                <br>
                <br>
                <p id="mensagem" runat="server" class="erro">
                </p>
                <p id="sucesso" runat="server" style="color: green;" />
                <br>
            </div>
            <div id="divItem" class="divPainel" runat="server">
                <h3>
                    Registra Produto</h3>
                <table style="width: 90%;">
                    <tr>
                        <td class="liesquerda">
                            <asp:Label ID="Label2" runat="server">Produto:</asp:Label>
                        </td>
                        <td class="lidiretira">
                            <asp:TextBox ID="txtProduto" CssClass="text" runat="server" MaxLength="255"></asp:TextBox>
                            <asp:Button ID="btnLocaliza" CssClass="Button" runat="server" Text="Pesquisa" OnClick="btnLocaliza_Click"
                                CausesValidation="true" ValidationGroup="salvar" />
                        </td>
                    </tr>
                    <tr>
                        <td class="liesquerda">
                            <asp:Label ID="Label3" runat="server">Observação:</asp:Label>
                        </td>
                        <td class="lidiretira">
                            <asp:TextBox ID="txtObservacao" CssClass="text" runat="server" TextMode="MultiLine"
                                MaxLength="255"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="liesquerdaButton">
                            <asp:Button ID="Button1" CssClass="Button" runat="server" Text="Voltar" OnClick="btnVoltar_Click"
                                CausesValidation="false" />
                        </td>
                        <td class="lidiretiraButton">
                            <asp:Button ID="Button2" CssClass="Button" runat="server" Text="Insere" OnClick="btnInsere_Click"
                                CausesValidation="true" ValidationGroup="salvar" />
                        </td>
                    </tr>
                </table>
                <br>
                <asp:GridView ID="gridProdutoVenda" runat="server" AutoGenerateColumns="false" CssClass="grid"
                    EmptyDataText="Insira itens">
                    <FooterStyle CssClass="gridFooter" />
                    <HeaderStyle CssClass="gridHeader" />
                    <RowStyle CssClass="gridRow" />
                    <Columns>
                        <asp:BoundField DataField="operacaolancamentoId" HeaderText="Código" Visible="false" />                        
                        <asp:BoundField DataField="produtoId" HeaderText="Código" />
                        <asp:BoundField DataField="produto" HeaderText="produto" />
                        <asp:TemplateField HeaderText="Delete">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgDelete" runat="server" CommandArgument='<%# Eval("operacaolancamentoId") %>'
                                    CommandName="Delete" CssClass="grd_edite" ImageUrl="~/Images/icon_cross.png"
                                    OnClick="imgDelete_Click" OnClientClick="return confirm('Tem certeza que deseja excluir Item?')" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <br>
                <p id="P1" runat="server" class="erro">
                </p>
                <p id="P2" runat="server" style="color: green;" />
                <br>
            </div>
            <div id="divProduto" runat="server"  style="width: 100%; height: 100%; background-color: Black;
                position: fixed; top: 0px; left: 0px; display:none;">
                <div style="text-align: center; background-color: #cccccc; z-index: 100; width: 60%;
                    margin-left: 20%; margin-top: 5%; text-align:center; height:calc(100% - 140px);" class=divPainel>
                    <h3>
                        Consulta Produto</h3>
                    <table style="margin-left:10%;">
                        <tr>
                            <td><asp:Label ID="nome" runat="server">Produto:</asp:Label>
                            </td>
                            <td><asp:TextBox ID="TextBox1" CssClass="text" runat="server" MaxLength="255"></asp:TextBox></td>
                            <td><asp:Button ID="Button3" CssClass="Button" runat="server" Text="Pesquisa" OnClick="btnPesquisa_Click" />
                            </td>
                        </tr>
                        
                    </table>
                    <p id="P3" runat="server" class="erro">
                    </p>
                    <asp:GridView ID="gridProduto" runat="server" AutoGenerateColumns="false" CssClass="grid"
                        EmptyDataText="Realize sua Pesquisa">
                        <FooterStyle CssClass="gridFooter" />
                        <HeaderStyle CssClass="gridHeader" />
                        <RowStyle CssClass="gridRow" />
                        <Columns>
                            <asp:BoundField DataField="produtoId" HeaderText="Código" />
                            <asp:BoundField DataField="Descricao" HeaderText="Produto" />
                            <asp:BoundField DataField="valor" HeaderText="Valor" />
                            <asp:TemplateField HeaderText="Seleciona">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgDelete" runat="server" CommandArgument='<%# Eval("ProdutoId") %>'
                                        CommandName="Seleciona" CssClass="grd_edite" ImageUrl="~/Images/icon_approve.png"
                                        OnClick="imgSeleciona_Click"  />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <br>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
